//
// Created by ZLY on 2025/5/11.
//

#ifndef HUD_STATS_H
#define HUD_STATS_H
#include "../core/object_screen.h"

class Sprite;
class Actor;

class HUDStats : public ObjectScreen {
protected:
    Actor *target_ = nullptr;
    Sprite *target_sprite_ = nullptr;
    Sprite *health_bar_ = nullptr;
    Sprite *health_bar_bg_ = nullptr;
    Sprite *health_icon_ = nullptr;
    Sprite *mana_bar_ = nullptr;
    Sprite *mana_bar_bg_ = nullptr;
    Sprite *mana_icon_ = nullptr;

    float health_percent_ = 1.0f;
    float mana_percent_ = 1.0f;
    //TODO: 位置设置
public:
    static HUDStats *addHUDStatsChild(Object *parent, Actor *target, glm::vec2 render_pos);

    void init() override;

    void update(float dt) override;

    [[nodiscard]] Sprite *getHealthBar() const {
        return health_bar_;
    }

    void setHealthBar(Sprite *health_bar) {
        health_bar_ = health_bar;
    }

    [[nodiscard]] Sprite *getHealthBarBg() const {
        return health_bar_bg_;
    }

    void setHealthBarBg(Sprite *health_bar_bg) {
        health_bar_bg_ = health_bar_bg;
    }

    [[nodiscard]] Sprite *getHealthIcon() const {
        return health_icon_;
    }

    void setHealthIcon(Sprite *health_icon) {
        health_icon_ = health_icon;
    }

    [[nodiscard]] Sprite *getManaBar() const {
        return mana_bar_;
    }

    void setManaBar(Sprite *mana_bar) {
        mana_bar_ = mana_bar;
    }

    [[nodiscard]] Sprite *getManaBarBg() const {
        return mana_bar_bg_;
    }

    void setManaBarBg(Sprite *mana_bar_bg) {
        mana_bar_bg_ = mana_bar_bg;
    }

    [[nodiscard]] Sprite *getManaIcon() const {
        return mana_icon_;
    }

    void setManaIcon(Sprite *mana_icon) {
        mana_icon_ = mana_icon;
    }

    [[nodiscard]] float getHealthPercent() const {
        return health_percent_;
    }

    void setHealthPercent(float health_percent) {
        health_percent_ = health_percent;
    }

    [[nodiscard]] float getManaPercent() const {
        return mana_percent_;
    }

    void setManaPercent(float mana_percent) {
        mana_percent_ = mana_percent;
    }

    void setTarget(Actor *target) {
        target_ = target;
    }

    [[nodiscard]] Actor *getTarget() const {
        return target_;
    }

    void updateHealthBar();

    void updateManaBar();
};
#endif //HUD_STATS_H
